package com.xxx.dto;

import java.io.Serializable;

/**
 * 接口返回基类（带业务数据）
 * 
 * 
 * 
 */
public class ResponseDTO extends BaseDTO implements Serializable {

	private static final long serialVersionUID = -2856340853993127841L;
	
	private Object data;

	public ResponseDTO(int code, String msg, Object data) {
		super(code, msg);
		this.data = data;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public static ResponseDTO builtSuccess() {
		return builtSuccess(null);
	}

	public static ResponseDTO builtSuccess(Object data) {
		return new ResponseDTO(SUCCESS, SUCCESS_MSG, data);
	}

	public static ResponseDTO builtSuccess(String msg, Object data) {
		return new ResponseDTO(SUCCESS, msg, data);
	}

	public static ResponseDTO builtFail(String msg) {
		return new ResponseDTO(FAILD, msg, null);
	}

	public static ResponseDTO builtFail(int code, String msg) {
		return new ResponseDTO(code, msg, null);
	}

	public static ResponseDTO builtException() {
		return new ResponseDTO(EXCEPTION, EXCEPTION_MSG, null);
	}
}
